home *** CD-ROM | disk | FTP | other *** search
- <HTML>
- <HEAD><TITLE><? echo $TITLE > -- online library</TITLE></HEAD>
- <BODY TEXT="#000000" BGCOLOR="#c0c0c0" LINK="#0000E0" VLINK="#00E000" ALINK="#E00000" >
- <center><? echo "<b>$TITLE</b> -- <a href=\"$URL\">$URL" > </A> rebuilt <BR>
-
- <!-- Generated by TREe2MSGbrd.PHP;
- <? echo "$IN, lines-per-page=$PERPAGE; pageprefix=$PAGENAME" > -->
-
- <?
- /* pages count from 1; $perpage<=0 or $pageno<=0 means All */
- /* cuts ONLY at whole threads */
- /*Function tre2msgb ();*/
-
- /* global $PERPAGE,$IN,$PAGENAME;*/
- $pageno = intval(ereg_replace( "(.*/)*"+$PAGENAME, "", $PATH_DIR)); /* .../x/y/pagename34... = no.34 */
- #$pageno = 1; $IN="MB155985.TRE";
- #$PERPAGE = 50;
- $fromline = 0; $toline = 0;
- echo "page $pageno; (about $PERPAGE posts per page); ";
- if ($pageno>0 && $PERPAGE>0) {
- if ($pageno>1) { echo "<a href=\"$PAGENAME", sprintf("%02d",$pageno-1), ".HTM\">prev</a>; "; }
- echo "<a href=\"$PAGENAME", sprintf("%02d", $pageno+1), ".HTM\">next</a>";
- $toline = $pageno * $PERPAGE; $fromline = $toline - $PERPAGE;
- }
- echo "</center><BR><hr>\n";
-
- if (fileSize($IN) <=0) { echo "sorry - file not found $IN"; exit; }
- $h = fopen( $IN, "r"); /* fails if not found! */
- if ($h==-1) { echo "sorry"; exit; }
- $lvlprev=0; $lvl=0; $missing=0; $lines=0; $threads=0; $herelines=0;
- $on=0; $getout=0;
- while (!feof($h) && !$getout) { /*oh, no break nor continue :( */
- $lines++;
- $lvl = intval(fgets($h,20)); /* string is always non-zero, so make it number */
- $mail=fgets($h,200); $name=fgets($h,200);
- $mssg=fgets($h,30); $subj=fgets($h,512); $date=fgets($h,50);
- /* fgets($h,20); */ /* one empty line!*/
- if (!$lvl && $lines>=$fromline) { /*main msg only*/
- $on=1; if ($toline > 0 && $lines > $toline) { $getout=1; $on=0; }
- }
-
- if ($on) { $herelines++;
- $i=$lvl; while ($i<$lvlprev) { echo "</ul>"; $i++; }
- $i=$lvlprev; while ($i<$lvl) { echo "<ul>"; $i++; }
- if (!$lvl) { $threads++; echo "\n<hr>"; }
-
- $m = strlen($mail);
- if ($m>1) { $mail=substr($mail,0,$m-1); echo "<A HREF=\"mailto:$mail\">"; }
- echo $name; if ($m>1) { echo "</A>"; }
- echo ": ";
-
- $mss9= substr($mssg,0,2)+"/"+substr($mssg,0,strlen($mssg)-1); /* $autoprefix */
- $mssg = ereg_replace( "\.9$", "\.HTM", $mss9); /*files named *.9 are NOT recognised as HTML. why?*/
- /* $missing = 0; does not work?!
- if ((fileType($mssg) == -1) && (fileType($mss9) == -1)) { $missing++; }
- /* $dup=0; if ($msgprev==$mssg) { $dup++; }
- $msgprev = $mssg;
- if ($dup) { echo "dup: "; }
- if ($disable_missing_links && !$missing) { echo "OK: "; }
- */
- if (!$missing) { echo "<A HREF=\"$mssg\">"; }
- else { echo "missing($mssg or .9): "; }
- if (!$lvl) { echo "<B>"; } echo $subj; if (!$lvl) { echo "</B>"; }
- if (!$missing) { echo "</A>"; }
- echo " $date<BR>\r\n";
- $lvlprev = $lvl;
- }
- }
- fclose($h);
- while ($lvlprev>0) { echo "</ul>"; $lvlprev--; }
- echo "<BR><BR>----------- eo page ";
- if ($pageno>0 && $PERPAGE>0) { echo $pageno; }
- if (!$getout) { echo "; ----- eo archive"; }
- /*); /*eo func*/
-
- /*not strtok nor regexps understand from \f, \r, \b, \xXX or any escaped things.
- so, replace them with new line and read 6 lines :(
- newline is included in the string from fgets! so do substr(sz-1) :(
- -no such function
- $l=strtr($l,"\f","~");
- -does not work
- ereg( "^([^\f]*)\f([^\f]*)\f([^\f]*)\f([^\f]*)\f([^\f]*)\f([^\f]*)",$l, $regs);
- $lvl=0+$regs[1]; $mail=$regs[2]; $name=$regs[3]; $mssg=$regs[4]; $subj=$regs[5]; $date=$regs[6];
- -does not work
- $l = ereg_replace( "\f", " \f", $l); $lvl = 0+strtok($l, "\f"); $mail= strtok("\f"); $name= strtok("\f"); $mssg= strtok("\f"); $subj= strtok("\f"); $date= strtok("\f");
- and there's no ?: operator, and ..., and, ...
- well, this php2 is crap - almost every line here is a workaround
- -don't use fuctions for big things, they eat too mauch space
- */
- >
- <!-- Generated by TREe2MSGbrd.PHP;
- <? echo "page $pageno; threads=$threads; lines=$fromline-$toline ($herelines)" >
- SvD Jul'99 -->
- </BODY></HTML>
-